package com.max.eshop.comporators;

import java.util.Comparator;
import com.max.eshop.core.Book;

public class SortedBooksByDateOfPublication implements Comparator<Book> {

	@Override
	public int compare(Book arg0, Book arg1) {
		if (arg0.getDateOfPublication().after(arg1.getDateOfPublication())) {
			return 1;
		} else if (arg0.getDateOfPublication().before(
				arg1.getDateOfPublication())) {
			return -1;
		} else {
			return 0;
		}
	}

}